import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { JobPositionVO, JobPositionForm, JobPositionQuery } from '@/api/system/jobPosition/types';

/**
 * 查询职位信息列表
 * @param query
 * @returns {*}
 */

export const listJobPosition = (query?: JobPositionQuery): AxiosPromise<JobPositionVO[]> => {
  return request({
    url: '/system/jobPosition/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询职位信息详细
 * @param positionId
 */
export const getJobPosition = (positionId: string | number): AxiosPromise<JobPositionVO> => {
  return request({
    url: '/system/jobPosition/' + positionId,
    method: 'get'
  });
};

/**
 * 新增职位信息
 * @param data
 */
export const addJobPosition = (data: JobPositionForm) => {
  return request({
    url: '/system/jobPosition',
    method: 'post',
    data: data
  });
};

/**
 * 修改职位信息
 * @param data
 */
export const updateJobPosition = (data: JobPositionForm) => {
  return request({
    url: '/system/jobPosition',
    method: 'put',
    data: data
  });
};

/**
 * 删除职位信息
 * @param positionId
 */
export const delJobPosition = (positionId: string | number | Array<string | number>) => {
  return request({
    url: '/system/jobPosition/' + positionId,
    method: 'delete'
  });
};
